package com.qyhl.webtv.module_microvideo.shortvideo.play.player;

import tv.danmaku.ijk.media.player.IjkMediaPlayer;

public class VideoManager {
    private static IjkMediaPlayer mMediaPlayer;

    public static IjkMediaPlayer getInstance() {
        if (mMediaPlayer == null) {
            mMediaPlayer = new IjkMediaPlayer();
        }
        mMediaPlayer.reset();
        return mMediaPlayer;
    }

    public static void pause() {
        if (mMediaPlayer != null && mMediaPlayer.isPlaying()) {
            mMediaPlayer.pause();
        }
    }

    public static void start() {
        if (mMediaPlayer != null) {
            mMediaPlayer.start();
        }
    }

    public static void releaseAll() {
        if (mMediaPlayer != null) {
            mMediaPlayer.stop();
            mMediaPlayer.release();
            mMediaPlayer = null;
        }
    }
}
